//
// Created by Administrator on 2025/4/20/周日.
//
#include "iostream"

using namespace std;


class Person {
public:
    int age;

    Person(int age) {
        this->age = age;
    }

    //添加年龄
    Person& addPerson(Person &p) {
        this->age = this->age + p.age;
        return *this;
    }
};


//解决名字冲突
void test() {
    Person p1(10);
    cout << p1.age << endl;

}

void test02() {
    Person p1(20);
    Person p2(50);
    p2.addPerson(p1).addPerson(p1).addPerson(p1);
    cout << p2.age << endl;
}

int main() {
//    test();
    test02();
}